package com.example.clooweather;

import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

public class StartActivity extends AppCompatActivity {
    private final int START_ACTIVITY = 0x1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        //去标题
        //requestWindowFeature(Window.FEATURE_NO_TITLE);如果这句话无法起到作用可以使用下面这句话去掉标题
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_start);
        handler.sendEmptyMessageDelayed(START_ACTIVITY, 500);

    }

    private Handler handler = new Handler() {
        //用于闪屏页面的实现
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case START_ACTIVITY:
                    startActivity(new Intent(StartActivity.this, MainActivity.class));
                    finish();
                    break;
            }
        }
    };
}
